<?php foreach($emailDetails as $emailNum => $detail): ?>
	<div class="toggler">
		<span class="subject"><?php echo $detail['header']['subject']; ?></span>
		<span class="from"><?php echo $detail['header']['fromaddress']; ?></span>
		<span class="date">on <?php echo $detail['header']['date']; ?></span>
	</div>
	<div class="body">
		<?php echo $detail['body']['message']; ?><br /><br />
		
		<?php if(!empty($detail['body']['attachment'])): ?>
			Attachments:<br />
			<?php foreach($detail['body']['attachment'] as $name => $attachment): ?>
				<?php echo $name; ?><br />
			<?php endforeach; ?>
		<?php endif; ?>
	</div>
<?php endforeach; ?>